/*!
\copyright  Copyright (c) 2023 Qualcomm Technologies International, Ltd.\n
            All Rights Reserved.\n
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file
\defgroup   dfu_version_share_profile DFU Version Share Profile
\ingroup    dfu
\brief      Public interface for DFU Version Sharing Profile.

            This module manages the DFU Version Profile for
            sharing of dfu version data between earbuds.
*/

/*! \addtogroup dfu_version_share_profile
 @{
*/

#ifndef DFU_VERSION_SHARE_PROFILE_H_
#define DFU_VERSION_SHARE_PROFILE_H_

#include "domain_message.h"
#include <message_.h>
#include <bdaddr_.h>
#include <vm.h>

#include <rtime.h>
#include <message.h>

#include <logging.h>
#include <panic.h>
#include <system_clock.h>
#include <stream.h>
#include <sink.h>
#include <source.h>
#include <stdlib.h>
#include <bt_device.h>
#include "upgrade.h"

/*! \brief Confirmation message with the result of the version comparison b/w earbuds.*/
typedef struct
{
    /*! Status of the version comparison. */
    upgrade_cross_version_status_t dfu_version_comparison_result;
} DFU_VERSION_SHARE_PROFILE_VERSION_COMPARISON_RESULT_T;

/*! \brief Events sent by DFU Version Share Profile to client. */
typedef enum
{
    /*! Module initialisation complete */
    DFU_VERSION_SHARE_PROFILE_INIT_CFM = DFU_VERSION_SHARE_MESSAGE_BASE,

    /*! Indication that version comparison is done. */
    DFU_VERSION_SHARE_PROFILE_COMPARISON_RESULT,

    /*! Indication that some error has occured. */
    DFU_VERSION_SHARE_PROFILE_ERROR,

    /*! This must be the final message */
    DFU_VERSION_SHARE_PROFILE_MESSAGE_END
} dfu_version_share_msg_t;


/*! \brief Exchanges dfu version data via L2CAP and compares the versions
    of two earbuds and get the version comparison result as a message.

    \return void
*/
void DfuVersionShareProfile_GetVersion(Task app_task);

/*! \brief Initialize and registers the DFU Version Share Profile.

    \return TRUE if Inited, FALSE if not.
*/
bool DfuVersionShareProfile_Init(Task init_task);

/*! \brief Query the Central Earbud's Bluetooth Address

    \return TRUE if bluetooth address is found , FALSE if not found.
*/
bool DfuVersionShareProfile_DeviceGetCentralBdAddr(bdaddr* bd_addr);

/*! \brief Query the Peripheral Earbud's Bluetooth Address

    \return TRUE if bluetooth address is found , FALSE if not found.
*/
bool DfuVersionShareProfile_DeviceGetPeripheralBdAddr(bdaddr* bd_addr);

#endif /* DFU_VERSION_SHARE_PROFILE_H_ */

/*! @} End group documentation in Doxygen */

